package com.ushine.design.jdk8.optional;

import java.util.Optional;

/**
 * @Author: yls
 * @Date: 2021/8/30 14:27
 * @Description: 用户信息
 * @Version 1.0
 */
public class User {

    /**
     * 用户姓名
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    private String position;

    private Address address;

    public Optional<Address> getAddress() {
        return Optional.ofNullable(address);
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public Optional<String> getPosition() {
        return Optional.ofNullable(position);
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public User() {

    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
